<?php

/**
 * DM libraries loader
 */

class DM_Loader {
	static function load( $path, $prePath = null ) {                
                if ( !empty($prePath) ) {
                    if ( file_exists($prePath.'/'.$path.'.php') ) {
                        require_once($prePath.'/'.$path.'.php');
                        return true;
                    }
                } else {
                    if ( file_exists($path.'.php') ) {                        
                        require_once($path.'.php');
                        return true;
                    }
                }
                if ( file_exists(DM_PATH.'/'.$path.'.php') ) {                    
                    require_once(DM_PATH.'/'.$path.'.php');
                    return true;
		}
		throw new Exception('Include file '.$path.' not found. '.$prePath.'/'.$path.'.php');
		return false;
	}	
}

?>